package io.xxx.xbutler.domain.task;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.xxx.xbutler.domain.RoomCategory;
import io.xxx.xbutler.domain.SelectMode;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.ArrayTypeHandler;
import org.apache.ibatis.type.EnumTypeHandler;

import java.time.LocalDateTime;
import java.util.List;

@Data
@Accessors(chain = true)
public class TaskTemplate {

    @TableId
    private Long id;

    private String name;

    private TaskScene scene;

    private Integer areaId;

    private String areaName;

    private Integer operateAreaId;

    private String operateAreaName;

    private Long businessUnitId;

    private String businessUnitName;

    private LocalDateTime effectiveStartTime;

    private LocalDateTime effectiveEndTime;

    @TableField(typeHandler = EnumTypeHandler.class)
    private RoomCategory roomCategory;

    @TableField(typeHandler = EnumTypeHandler.class)
    private SelectMode selectMode;

    private String selectContent;

    @TableField(typeHandler = EnumTypeHandler.class)
    private TimeType timeType;

    @TableField(typeHandler = ArrayTypeHandler.class)
    private Integer[] days;

    private Long createdId;

    private String createdName;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdTime;

    private Long updatedId;

    private String updatedName;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedTime;

    @TableField(exist = false)
    private Long periodId;

    @TableField(exist = false)
    private LocalDateTime startTime;

    @TableField(exist = false)
    private LocalDateTime endTime;

    @TableField(exist = false)
    private List<TaskTemplatePeriod> periods;

    @TableField(exist = false)
    private List<List<TaskTemplateItem>> items;
}
